<template>
  <div>
    <button @click="updateName">修改姓名</button>
  </div>
</template>

<script>
export default {
  name:"TestB",
  methods: {
    updateName() {
      const newName = "谭磊";
      this.$store.dispatch("updateUserName", newName);
    }
  }
};
</script>